package com.heima.user.controller;

import com.heima.common.dtos.ResponseResult;
import com.heima.model.user.dtos.AuthDto;
import com.heima.model.user.dtos.UserAuthDto;
import com.heima.user.entity.ApUserAuth;
import com.heima.user.service.ApUserAuthService;
import com.heima.user.service.ApUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author RMY
 * @Date 2021/11/24 21:26
 * @Version 1.0
 */
@RestController
public class UserAuthController {
    @Autowired
    private ApUserAuthService apUserAuthService;

    /**
     * 审核通过
     * @param authDto
     * @return
     */
    /**
     * 状态
     0 创建中
     1 待审核
     2 审核失败
     9 审核通过
     */
    @PostMapping("/api/v1/auth/authPass")
    public ResponseResult authPass(@RequestBody AuthDto authDto){
        apUserAuthService.authPassOrauthFail(authDto,9);
        return ResponseResult.ok();
    }

    @PostMapping("/api/v1/auth/authFail")
    public ResponseResult authFail(@RequestBody AuthDto authDto){
        apUserAuthService.authPassOrauthFail(authDto,2);
        return ResponseResult.ok();
    }
}
